package com.xdk.templatescala.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @author zhaoyue
 * @description DataSourceConfig 多数据源配置类
 * @date 2021/8/4
 **/
@Configuration
public class DataSourceConfig {

    @Primary
    @Bean(name = "lowCodeDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.lowcode")
    public DataSource lowCodeDataSource(){
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "camundaBpmDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.camunda")
    public DataSource camundaDataSource(){
        return DataSourceBuilder.create().build();
    }

}
